package com.a.b.c.d.e.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * Created on 2021/9/1.
 *
 * @author yanshuchun
 */
public class UrlTest {
    public static void main(String[] args) {
        String url = "http://1123123/中文.doc";
        int i = url.lastIndexOf("/");
        try {
            System.out.println(url.substring( 0,i+1)+ URLEncoder.encode(url.substring(i+1),"utf-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

    }
}
